﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CuaHangDiaNhac
{
    public class ConvertType
    {
        public static string ToString(object ob)
        {
            try
            {
                return Convert.ToString(ob);
            }
            catch (Exception)
            {
                return "";
            }
        }
        public static decimal ToDecimal(object ob)
        {
            try
            {
                return Convert.ToDecimal(ob);
            }
            catch (Exception)
            {
                return 0;
            }
        }
        public static int ToInt(object ob)
        {
            try
            {
                return Convert.ToInt32(ob);
            }
            catch (Exception)
            {
                return 0;
            }
        }
        public static bool ToBool(object ob)
        {
            try
            {
                return Convert.ToBoolean(ob);
            }
            catch (Exception)
            {
                return false;
            }
        }
        public static DateTime ToDate(object ob)
        {
            try
            {
                return Convert.ToDateTime(ob);
            }
            catch (Exception)
            {
                return DateTime.Now;
            }
        }


    }
}
